package com.tajiang.business.setting.dialog;

import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.tajiang.business.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Administrator on 2016/8/2.
 */
public class BTConnectDialog extends Dialog {

    @BindView(R.id.tv_connect_view)
    TextView tvConnectView;
    @BindView(R.id.tv_ensure)
    TextView tvEnsure;
    @BindView(R.id.ll_ensure)
    LinearLayout llEnsure;
    @BindView(R.id.pb_progressbar)
    ProgressBar pbProgressbar;
    @BindView(R.id.ll_content_view)
    LinearLayout llContentView;

    public BTConnectDialog(Context context) {
        super(context, R.style.dialog_operate);
        View view = LayoutInflater.from(context).inflate(R.layout.layout_blue_tooth_connecting_dialog, null);
        setContentView(view);
        ButterKnife.bind(this);
        initView();
    }

    private void initView() {
        this.setCancelable(false);
        this.llEnsure.setVisibility(View.GONE);
    }

    public BTConnectDialog setText(String msg) {
        this.tvConnectView.setText(msg);
        return this;
    }

    public BTConnectDialog setButtonEnable(boolean visiable) {
        llEnsure.setVisibility(visiable == true ? View.VISIBLE : View.GONE);
        return this;
    }

    public BTConnectDialog setProgressBarEnable(boolean visiable) {
        pbProgressbar.setVisibility(visiable == true ? View.VISIBLE : View.GONE);
        return this;
    }

    @OnClick(R.id.tv_ensure)
    public void onClick() {
        this.dismiss();
    }
}
